import { number } from 'echarts';

import http from '../utils/axios';
import dayjs from 'dayjs'
// 轮播接口
interface slideData {
  currentPage?: number
  keyWord?: string
  pageSize?: number
  sortWay?: string
  state?: number
  upTime?: string | dayjs.Dayjs
  carouselId?: number | undefined
  carouselIuptimeEnd?: string | dayjs.Dayjs
  carouselUptimeStart?: string | dayjs.Dayjs
  carouselLocation: number
  carouselType: string
  carouselUpordown: number
  carouselTital: string
  carouselPic: string
  carouselTime: string | undefined
}

// 专区接口
interface zoneData {
  currentPage?: number
  pageSize?: number
  keyWord?: string
  sortWay?: string
  state?: number
  upTime?: string
  tsaId?: number
  tsaUptimeStart?: string | dayjs.Dayjs
  tsaUptimeEnd?: string | dayjs.Dayjs
  tsaArrange?: string
  tsaUpordown?: number
  tsaLocation?: number
  tsaTime?: string | dayjs.Dayjs
  tsaName?: string
}

// 搜索接口
interface searchData {
  currentPage?: number,
  pageSize?: number,
  id?: number,
  searchLocation?: number,
  searchState?: number,
  searchId?: number
}

// 轮播管理
// (1)获取初始数据
export const getSlide = (data: any) => (http.post<any>('/other/shopping-mall/carousel/display', data))
//（2）单个删除
export const delSlide = (params: any) => (http.get<any>('/other/shopping-mall/carousel/delone', params))
// (3)批量删除
export const delBatchSlide = (data: any) => (http.post<any>('/other/shopping-mall/carousel/batchDel', data))
// (4)上传图片
export const upProtoSlide = (data: any) => (http.post<any>('/other/shopping-mall/carousel/upload', data, { headers: { 'Content-Type': ' multipart/form-data' } }))
// (5)修改轮播信息
export const revSlide = (data: any) => (http.post<any>('/other/shopping-mall/carousel/update', data))
// (6)添加轮播信息
export const addSlide = (data: any) => (http.post<any>('/other/shopping-mall/carousel/add', data))


// 专区管理
// （1）获取初始数据
export const getZone = (data: zoneData) => (http.post<any>('/other/shopping-mall/tsa/show', data))
// （2）单个删除
export const delZone = (params: zoneData) => (http.get<any>('/other/shopping-mall/tsa/del', params))
// (3)批量删除
export const delBatchZone = (data: any) => (http.post<any>('/other/shopping-mall/tsa/batchDel', data))
// (4)添加
export const addZone = (data: zoneData) => (http.post<any>('/other/shopping-mall/tsa/add', data))
// (5)编辑
export const revZone = (data: zoneData) => (http.post<any>('/other/shopping-mall/tsa/update', data))

// 专区商品管理
// （1）获取初始数据
export const getShop = (data: any) => (http.post<any>('/other/shopping-mall/tsa/getTsaGoods', data))
// (2)移出商品
export const delShop = (data: any) => (http.post<any>('/other/shopping-mall/tsa/delGoods', data))
// (3)设置商品位置
export const setLocationShop = (data: any) => (http.post<any>('/other/shopping-mall/tsa/updateLocation', data))
// export const delShop = (params: number) => (http.get<any>('/shopping-mall/tsa/delGoods', params))

// 专区管理添加商品
// （1）获取初始数据
export const getAddShop = (data: any) => (http.post<any>('/other/shopping-mall/tsa/selectGoods', data))
// (2)添加商品到指定专区
export const addShop = (params: any) => (http.get<any>('/other/shopping-mall/tsa/insertGoods', params))
// (3)查询分级信息
export const getLevel = () => (http.get<any>('/other/shopping-mall/tsa/getLevel'))
// (4)查询品牌信息
export const getBrand = () => (http.get<any>('/other/shopping-mall/tsa/selectBrand'))


// 搜索管理
// （1）获取初始数据
export const getSreach = (data: any) => (http.post<any>('/other/shopping-mall/search/show', data))
// (2)单个删除
export const delSreach = (params: any) => (http.get<any>('/other/shopping-mall/search/del', params))
//（3）编辑
export const revSreach = (data: any) => (http.post<any>('/other/shopping-mall/search/update', data))
// (4)增加
export const addSreach = (data: any) => (http.post<any>('/other/shopping-mall/search/add', data))



// 标签管理
// （1）获取初始数据
export const getTag = (data: any) => (http.post<any>('/other/shopping-mall/label/showLabel', data))
// (2)删除单个
export const delTag = (params: any) => (http.get<any>('/other/shopping-mall/label/delLabel', params))
// (3)添加标签
export const addTag = (data: any) => (http.post<any>('/other/shopping-mall/label/addLabel', data))
// (4)编辑标签
export const revTag = (data: any) => (http.post<any>('/other/shopping-mall/label/updateLabel', data))
//（5）查询标签在添加商品时使用
export const getAddTag = () => (http.get<any>('/other/shopping-mall/label/getAll'))

// 运费管理
// （1）获取初始数据
export const getFreight = (data: any) => (http.post<any>('/other/shopping-mall/freight/show', data))
// (2)删除运费
export const delFreight = (params: any) => (http.get<any>('/other/shopping-mall/freight/del', params))
// (3)添加运费信息
export const addFreight = (data: any) => (http.post<any>('/other/shopping-mall/freight/add', data))
// (4)修改运费信息
export const revFreight = (data: any) => (http.post<any>('/other/shopping-mall/freight/update', data))
//（5）查询包邮金额
export const freightMoney = () => (http.get<any>('/other/shopping-mall/freeShopping/select'))
//(6)修改包邮金额
export const revFreightMoney = (params: any) => (http.get<any>('/other/shopping-mall/freeShopping/update', params))


// 商品回收站
// （1）获取初始数据
export const getGoodRecycle = (data: any) => (http.post<any>('/shopping/goods/getListFindByCon', data))
// （2）获取类别
export const getCategory = () => (http.get<any>('/shopping/category/findAll'))
// (3)获取品牌
export const getGoodBrand = () => (http.get<any>('/shopping/brand/getList'))
// (4)单个删除
export const delGoodRecycle = (data: any) => (http.post<any>('/shopping/goods/delDelByIds', data))



